"use client"; import { Suspense, useState } from "react"; import { useParams, useRouter } from "next/navigation"; import HighlightCard from "@/components/dashboard/highlights/HighlightCard"; import ReaderView from "@/components/dashboard/preview/ReaderView"; import { Button } from "@/components/ui/button"; import { FullPageSpinner } from "@/components/ui/full-page-spinner"; import { Popover, PopoverContent, PopoverTrigger, } from "@/components/ui/popover"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@/components/ui/select"; import { Separator } from "@/components/ui/separator"; import { Slider } from "@/components/ui/slider"; import { HighlighterIcon as Highlight, Minus, Plus, Printer, Settings, Type, X, } from "lucide-react"; import { useSession } from "next-auth/react"; import { api } from "@karakeep/shared-react/trpc"; import { BookmarkTypes } from "@karakeep/shared/types/bookmarks"; import { getBookmarkTitle } from "@karakeep/shared/utils/bookmarkUtils"; export default function ReaderViewPage() { const params = useParams<{ bookmarkId: string }>(); const bookmarkId = params.bookmarkId; const { data: highlights } = api.highlights.getForBookmark.useQuery({ bookmarkId, }); const { data: bookmark } = api.bookmarks.getBookmark.useQuery({ bookmarkId, }); const { data: session } = useSession(); const router = useRouter(); const [fontSize, setFontSize] = useState([18]); const [lineHeight, setLineHeight] = useState([1.6]); const [fontFamily, setFontFamily] = useState("serif"); const [showHighlights, setShowHighlights] = useState(false); const [showSettings, setShowSettings] = useState(false); const isOwner = session?.user?.id === bookmark?.userId; const fontFamilies = { serif: "ui-serif, Georgia, Cambria, serif", sans: "ui-sans-serif, system-ui, sans-serif", mono: "ui-monospace, Menlo, Monaco, monospace", }; const onClose = () => { if (window.history.length > 1) { router.back(); } else { router.push("/dashboard"); } }; const handlePrint = () => { window.print(); }; return (
{/* Header */}
Reader View

Reading Settings

{fontSize[0]}px
{lineHeight[0]}
{/* Mobile backdrop */} {showHighlights && (
{highlights.highlights.map((highlight) => ( ))}
)} ); }